package cn.tedu.yxcar.product.controller;

import cn.tedu.yxcar.product.pojo.dto.ReservationAddDTO;
import cn.tedu.yxcar.product.service.IReservationServiceImpl;
import cn.tedu.yxcar.product.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/carReservation")
@Api(tags = "预约模块")
public class ReservationController {

    @Autowired
    private IReservationServiceImpl ReservationService;

    @PostMapping("/add")
    @ApiOperation("执行新增预约订单的功能")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public JsonResult addReservation(@Validated ReservationAddDTO reservationAddDTO){
        ReservationService.addNew(reservationAddDTO);
        return JsonResult.ok();
    }
}
